Skip to content

feat: Implement upsert functionality in overlay actions#4

Open
emilien-puget wants to merge 1 commit intopb33f:mainfrom
emilien-puget:upsert
Open

feat: Implement upsert functionality in overlay actions#4
emilien-puget wants to merge 1 commit intopb33f:mainfrom
emilien-puget:upsert

Conversation

@emilien-puget
Copy link

@emilien-puget emilien-puget commented Mar 5, 2026

Adds upsert action to overlays to create missing paths, refuses wildcard path

it seems the project was not go fmt, sorry for the changes on everyline

@emilien-puget emilien-puget marked this pull request as draft March 5, 2026 08:37
@codecov
Copy link

codecov bot commented Mar 16, 2026

Codecov Report

❌ Patch coverage is 69.55307% with 218 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@dbbb19d). Learn more about missing BASE report.

Files with missing lines Patch % Lines
pkg/jsonpath/yaml_query.go 77.83% 61 Missing and 21 partials ⚠️
pkg/jsonpath/segment.go 45.94% 58 Missing and 2 partials ⚠️
pkg/overlay/apply.go 71.09% 32 Missing and 18 partials ⚠️
pkg/overlay/parse.go 42.30% 9 Missing and 6 partials ⚠️
pkg/jsonpath/jsonpath.go 63.63% 6 Missing and 2 partials ⚠️
pkg/overlay/validate.go 66.66% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main       #4   +/-   ##
=======================================
  Coverage        ?   69.11%           
=======================================
  Files           ?       17           
  Lines           ?     2911           
  Branches        ?        0           
=======================================
  Hits            ?     2012           
  Misses          ?      705           
  Partials        ?      194           
Flag Coverage Δ
unittests 69.11% <69.55%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@emilien-puget emilien-puget marked this pull request as ready for review March 16, 2026 18:45
@emilien-puget
Copy link
Author

@daveshanley wdyt ?

return newNode
}

func createPath(root *yaml.Node, p *jsonpath.JSONPath, value *yaml.Node) error {
Copy link
Member

@daveshanley daveshanley Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

createPath is used when a target is absent, but both ensureArrayIndex and setArrayValue reject index >= len(...). So documented cases like $.items[0] on a missing array, or $.a.b[2].c, will fail instead of being materialized. It also means a failed upsert can leave partially-created parent nodes behind before returning the error.

(Codex found this)

@daveshanley
Copy link
Member

daveshanley commented Mar 23, 2026

@daveshanley wdyt ?

Like it! just one comment, thanks to the robots, but a really nice upgrade.

@daveshanley daveshanley changed the title Implement upsert functionality in overlay actions feat: Implement upsert functionality in overlay actions Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants